#include <stdio.h>
#include <stdlib.h>
#include<math.h>

/* run this program using the console pauser or add your own getch, system("pause") or input loop */

	int main(void){
		
		int repeat,m;
		int i,p,j,n[repeat];
		scanf("%d",&repeat);
		
		for(p=0;p<repeat;p++){
			scanf("%d",&n[p]);
		}
		
		for(m=0;m<repeat;m++){
			for(i=1;i<=n[m];i++){
				for(j=1;j<=(n[m]-i)*2;j++){
					printf(" ");
				}
				for(j=1;j<=2*i-1;j++){
					printf("%d ",i);
			}
			printf("\n");
		}
	}
		return 0;
		
		}